<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>

<c:set var="pagePath" value="/WEB-INF/jsp/admin/login.jsp" scope="request"/>
<%@ include file="../common/vars.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
  <head>
    <tiles:insertAttribute name="head" />
  </head>
  <body id="loginPage">
    <div id="allContent">

      <div id="header">
        <%-- The page links --%>
        <tiles:insertAttribute name="header-title" />
      </div>

      <div id="pageContent">

          <p id="welcome-info">
            <em><spring:theme code='admin.login.welcome.title' /></em><br/><br/>
            <spring:theme code='admin.login.welcome.message' />
          </p>
          <form id="loginForm" action="<c:url value='/admin/j_spring_security_check'/>" method="POST"
             class="basic loginform">

		 <%-- The error message --%>
	      <c:choose>
	        <c:when test="${not empty loginError}">
	          <p class=formGlobalError><spring:theme code='admin.login.auth.failure' /></p>
	        </c:when>
	        <c:when test="${not empty pwdForgottenError}">
	          <p class=formGlobalError><spring:theme code='admin.login.pwd.forgotten.failure' /></p>
	        </c:when>
	      </c:choose>

            <p class="row">
              <label for="login"><spring:theme code='field.admin.login.account.login' /></label>
              <input id="login" name="j_username" class="focused" type="text" size="150"
                  value="<c:if test='${not empty param.login_error}'>${SPRING_SECURITY_LAST_USERNAME}</c:if>" />
            </p>
            <p class="row">
              <label for="pwd"><spring:theme code='field.admin.login.account.pwd' /></label>
              <input id="pwd" name="j_password" type="password" size="150" />
            </p>

            <p class="row">
              <label>&nbsp;</label>
              <span class="buttonsList">
		          <jsp:include page="/WEB-INF/jsp/common/cmp/button.jsp">
		            <jsp:param name="id" value="submitBt"/>
		            <jsp:param name="label" value="admin.login.form.submit"/>
		            <jsp:param name="type" value="submit"/>
		          </jsp:include>
		      </span>
            </p>

            <p class="row">
              <label>&nbsp;</label>
              <spring:theme var="forgottenPwdInfoTitle" code="admin.login.forgotten.pwd.info.title"
                javaScriptEscape="true"/>
              <spring:theme var="forgottenPwdInfoMsg" code="admin.login.forgotten.pwd.info.msg"
                javaScriptEscape="true"/>
              <a class="actionLink" style="display:inline;" id="link_pwd_forgotten"
                href="javascript:;"
                onclick="showLinkInfoBox('link_pwd_forgotten', '${forgottenPwdInfoTitle}', '${forgottenPwdInfoMsg}', false);">
                <spring:theme code='admin.login.forgotten.pwd' /></a>
            </p>
          </form>

      </div>
    </div>
  </body>
</html>